package com.liuyi.netty.im.lychat.config;

import com.liuyi.netty.im.lychat.LychatConst;
import com.liuyi.netty.im.lychat.modular.entity.User;
import com.liuyi.netty.im.lychat.modular.service.IUserService;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * @author Mr.Fmy
 * @since 2021/12/30
 */
@Configuration
public class InitConfig {

    @Resource
    private IUserService userService;

    @PostConstruct
    public void initUser() {
        if (userService.count(User.USER_ID, LychatConst.SYS_USER_ID) <= 0) {
            userService.createUser(LychatConst.SYS_USER_ID, "lychat客服", "123456...");
        }
    }
}
